import VueRouter from "vue-router";
import HmLogin from "@/components/HmLogin.vue";
import Vue from "vue";
import HmRegister from "@/components/HmRegister.vue";
import HmLayOut from "@/views/HmLayOut.vue";
import HmDetail from "@/views/HmDetail.vue";
import HmArticle from "@/views/HmArticle.vue";
import HmLike from "@/views/HmLike.vue";
import HmCollect from "@/views/HmCollect.vue";
import HmUser from "@/views/HmUser.vue";
import HmRecommend from "@/views/HmRecommend.vue";
import HmNew from "@/views/HmNew.vue";

Vue.use(VueRouter);
const router = new VueRouter({
  mode: "history",
  routes: [
    { path: "/", redirect: "/login" },
    {
      path: "/login",
      component: HmLogin,
    },
    {
      path: "/register",
      component: HmRegister,
    },
    {
      path: "/detail",
      component: HmDetail,
    },
    {
      path: "/layout",
      component: HmLayOut,
      children: [
        {
          path: "/layout/article",
          component: HmArticle,
          children: [
            {
              path: "/layout/article/recommend",
              component: HmRecommend,
            },
            { path: "/layout/article/new", component: HmNew },
          ],
        },
        {
          path: "/layout/like",
          component: HmLike,
        },
        {
          path: "/layout/collect",
          component: HmCollect,
        },
        {
          path: "/layout/user",
          component: HmUser,
        },
      ],
    },
  ],
});
export default router;
